package edu.avans.hartigehap.domain;

import java.util.Date;
import java.util.Iterator;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;

import edu.avans.hartigehap.domain.Bill.BillStatus;

/**
 * 
 * @author Erco
 */
@Entity
//optional
public class LocalBill extends Bill
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private DiningTable diningTable;
	private Bill bill;
	public LocalBill()
	{
	}
	public LocalBill(Discount discount) {
		super(discount);
	}
	
	@OneToOne(cascade = CascadeType.ALL)
	public DiningTable getDiningTable() {
		return diningTable;
	}

	public void setDiningTable(DiningTable diningTable) {
		this.diningTable = diningTable;
	}
	
	public void setBill(Bill bill) {
		this.bill = bill;
	}

	public void submitOrder() throws StateException {
		currentOrder.submit();
		currentOrder = new Order();
		currentOrder.setBill(this);
		orders.add(currentOrder);
	}
}